package cn.line5.login;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import cn.line5.module.ModuleVo;
import cn.line5.seam.annotations.AjaxRemote;
import cn.line5.seam.annotations.In;
import cn.line5.seam.annotations.Name;
import cn.line5.seam.annotations.Out;
import cn.line5.seam.annotations.Request;

@Name("loginRemote")
/**
 * <h1>登录组件调用类</h1>
 * <br/>
 * 
 * @author Liu,Xiaojun
 */
public class LoginRemote {

	@Request
	private HttpServletRequest request;

	@Out
	private LoginVo loginUser;
	
	@Out
	private List<ModuleVo> list;

	@In("loginService")
	private LoginService loginService;

	/**
	 * 登录页面
	 */
	public void getLoginInfo() {
		loginUser = LoginUser.getLoginUser(request);
	}

	/**
	 * 登录
	 */
	@AjaxRemote
	public Boolean login(LoginVo vo) {
		vo = loginService.login(vo);
		if (vo != null) {
			LoginUser.setLoginSession(request, vo);
			return true;
		}
		return false;
	}
	
	/**
	 * 后台首页
	 */
	public void main() {
//		list = moduleService.getModuleList("");
	}

	/**
	 * 登出
	 */
	@AjaxRemote
	public Boolean loginOut() {
		LoginUser.clearLoginSession(request);
		return true;
	}
	
	public static void main(String[] args) {
		String x = "你好";
		char[] c = x.toCharArray();
		for(char _c : c){
			System.out.println(Integer.toBinaryString(_c));
		}
		System.out.println(">>>>" + Integer.toBinaryString('f'));
		System.out.println(">>>>" + ('3' & 'f'));
	}
}
